package com.itheima.model.behavior.pojos;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.io.Serializable;
import java.util.Date;
import java.util.Map;

/**
 * 用户行为记录实体类 (MongoDB)
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Document(collection = "user_behavior")
public class UserBehavior implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    private String id;

    @Field("user_id")
    @Indexed
    private Integer userId;

    @Field("behavior_type")
    @Indexed
    private String behaviorType;

    @Field("target_type")
    private String targetType;

    @Field("target_id")
    private String targetId;

    @Field("behavior_data")
    private Map<String, Object> behaviorData;

    @Field("duration")
    private Integer duration;

    @Field("create_time")
    @Indexed
    private Date createTime;
}
